﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine.Networking;
using UnityEngine;

public class ManageMotherBase : NetworkBehaviour
{
    [SyncVar(hook = "SendMessageToPlane")]
    private float motherBaseHp;
    [SyncVar]
    public GameObject player;


    private void Start()
    {
        motherBaseHp = 100;
    }

    public void TakeDamage(float damage)
    {
        motherBaseHp -= damage;
    }

    private void SendMessageToPlane(float Hp)
    {
        player.GetComponent<PlaneHp>().UpdateMBHp(Hp);
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            if(other.gameObject == player)
            {
                other.gameObject.GetComponent<PlaneController>().eraser.SetActive(true);
            }
        }
    }
}
